package codec

// OK Represents ok
var OK = New(0, "OK")

// NotFoundError represents not found error
var NotFoundError = New(1, "Not Found")

var (
	ErrRoom404          = NotFoundError.NewChild(1, "Room")
	ErrPlayer404        = NotFoundError.NewChild(2, "Player")
	ErrPuzzle404        = NotFoundError.NewChild(3, "Puzzle")
	ErrCharacterData404 = NotFoundError.NewChild(4, "Character")
	ErrObjName404       = NotFoundError.NewChild(5, "ObjName")
	ErrPlayerState404   = NotFoundError.NewChild(6, "PlayerState")
)

// InternalError represents those error is internal
var InternalError = New(2, "Internal System Error")

// IsInternalError returns whether the error is InternalError
func IsInternalError(e error) bool {
	code, ok := e.(Code)
	if !ok {
		return false
	}

	return code.FatherCode() == InternalError.Code()
}

// AuthError represents the error in authorization
var AuthError = New(3, "Auth Error")

var (
	ErrNoToken      = AuthError.NewChild(1, "No Such Token")
	ErrNotHost      = AuthError.NewChild(2, "Not The Host")
	ErrNotLogin     = AuthError.NewChild(3, "Not Logined")
	ErrInvalidToken = AuthError.NewChild(4, "Invalid Token")
)
